package com.sx.gongzhong.pest;

import android.content.Context;

import com.sx.gongzhong.model.HeadParamBean;
import com.sx.gongzhong.model.ReplyUserBean;
import com.sx.gongzhong.net.ApiManager;
import com.sx.gongzhong.net.BaseCallBack;
import com.sx.gongzhong.view.UpdatePasswordView;

import java.util.Map;

/**修改密码
 * Created by admin on 2018/1/2.
 */

public class UpdatePasswordPest {
    private UpdatePasswordView updatePasswordView;

    public UpdatePasswordPest(UpdatePasswordView updatePasswordView) {
        this.updatePasswordView = updatePasswordView;
    }
    public void updatePassword(Context context, String oldPassword, String password, String confirmPwd){
        Map<String,Object> map = HeadParamBean.getHead();
        map.put("oldPassword",oldPassword);
        map.put("password",password);
        map.put("confirmPwd",confirmPwd);
        new ApiManager().updatePassword(map, new BaseCallBack<ReplyUserBean.BaseResult<Boolean>>() {
            @Override
            public void onSuccess(ReplyUserBean.BaseResult<Boolean> response) {
                updatePasswordView.updatePasswordSuccess(response.data);
            }
            @Override
            public void onFailures(String message) {
                updatePasswordView.showError(message);
            }
        });
    }
}
